import javax.swing.*;
import java.awt.*;

public class DemoSplit extends JPanel
{
  String[] items = {"Uno","Dos","Tres","Cuatro","Cinco","Seis","Siete"};
    
  public DemoSplit()
  {
    setLayout(new BorderLayout());
    JTree tree = new JTree();        
    JList lista = new JList(items);
    JScrollPane left = new JScrollPane(tree);
    JScrollPane right = new JScrollPane(lista);
    left.setMinimumSize(new Dimension(0,0));
    right.setMinimumSize(new Dimension(0,0));
    JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right);
    pane.setDividerLocation(0.5);    
    pane.setOneTouchExpandable(true);
    add(pane, BorderLayout.CENTER);
  }

 public static void main(String args[])
 {
	  JFrame ventana=new JFrame("JSplitPane y JTree");
	  ventana.getContentPane().add(new DemoSplit());
	  ventana.setSize(300,250); 
	  ventana.setVisible(true);
	  ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
}

